package cn.ycc1.springquickstart.util;

/**
 * 双重检查锁定
 *
 * @author ycc
 * @date 2024/3/24
 */
public class Singleton3 {
    private static volatile Singleton3 instance;

    private Singleton3() {}

    public static Singleton3 getInstance() {
        if (instance == null) {
            synchronized (Singleton3.class) {
                if (instance == null) {
                    instance = new Singleton3();
                }
            }
        }
        return instance;
    }
}

